; The second flat tire domain from the UCPOP distribution.

(define (domain init-flat-tire2)
  (:requirements :equality :negative-preconditions :conditional-effects)
  (:constants wrench jack ground pump)
  (:predicates (annoyed) (container ?x) (locked ?x) (open ?x) (in ?x ?y)
	       (have ?x) (nut ?x) (hub ?x) (tight ?x ?y) (jacked ?x)
	       (loose ?x ?y) (on ?x ?y) (unfastened ?x) (wheel ?x) (free ?x)
	       (inflated ?x) (intact ?x) (tool ?x))
  (:action cuss
	   :parameters ()
	   :effect (not (annoyed)))
  (:action open
	   :parameters (?x)
	   :precondition (and (container ?x)
			      (not (locked ?x)) (not (open ?x)))
	   :effect (open ?x))
  (:action close
	   :parameters (?x)
	   :precondition (and (container ?x)
			      (open ?x))
	   :effect (not (open ?x)))
  (:action fetch
	   :parameters (?x ?y)
	   :precondition (and (container ?y)
			      (not (= ?x ?y)) (in ?x ?y) (open ?y))
	   :effect (and (have ?x) 
			(not (in ?x ?y))))
  (:action put-away
	   :parameters (?x ?y)
	   :precondition (and (container ?y)
			      (not (= ?x ?y)) (have ?x) (open ?y))
	   :effect (and (in ?x ?y)
			(not (have ?x))))
  (:action loosen
	   :parameters (?x ?y)
	   :precondition (and (nut ?x) (hub ?y)
			      (not (= ?x ?y)) (have wrench) (tight ?x ?y) 
			      (not (jacked ?y)))
	   :effect (and (loose ?x ?y)
			(not (tight ?x ?y))))
  (:action tighten
	   :parameters (?x ?y)
	   :precondition (and (nut ?x) (hub ?y)
			      (not (= ?x ?y)) (have wrench) (loose ?x ?y)
			      (not (jacked ?y)))
	   :effect (and (tight ?x ?y)
			(not (loose ?x ?y))))
  (:action jack-up
	   :parameters (?y)
	   :precondition (and (hub ?y)
			      (not (jacked ?y)) (have jack))
	   :effect (and (jacked ?y)
			(forall (?x) (when (on ?x ?y) (not (on ?x ground))))
			(not (have jack))))
  (:action jack-down
	   :parameters (?x)
	   :precondition (and (hub ?x)
			      (jacked ?x))
	   :effect (and (not (jacked ?x))
			(forall (?y) (when (on ?y ?x) (on ?y ground)))
			(have jack)))
  (:action undo
	   :parameters (?x ?y)
	   :precondition (and (nut ?x) (hub ?y)
			      (not (= ?x ?y))
			      (jacked ?y) (not (unfastened ?y))
			      (have wrench) (loose ?x ?y))
	   :effect (and (have ?x) (unfastened ?y)
			(not (on ?x ?y)) (not (loose ?x ?y))))
  (:action do-up
	   :parameters (?x ?y)
	   :precondition (and (nut ?x) (hub ?y)
			      (not (= ?x ?y))
			      (have wrench) (unfastened ?y)
			      (jacked ?y) (have ?x))
	   :effect (and (loose ?x ?y) (not (unfastened ?y)) (not (have ?x))))
  (:action remove-wheel
	   :parameters (?x ?y)
	   :precondition (and (wheel ?x) (hub ?y)
			      (not (= ?x ?y)) (jacked ?y)
			      (on ?x ?y) (unfastened ?y))
	   :effect (and (have ?x) (free ?y) (not (on ?x ?y))))
  (:action put-on-wheel
	   :parameters (?x ?y)
	   :precondition (and (wheel ?x) (hub ?y)
			      (not (= ?x ?y)) (have ?x) (free ?y)
			      (unfastened ?y)
			      (jacked ?y))
	   :effect (and (on ?x ?y) (not (have ?x)) (not (free ?y))))
  (:action inflate
	   :parameters (?x)
	   :precondition (and (wheel ?x)
			      (have pump) (not (inflated ?x)) (intact ?x))
	   :effect (inflated ?x)))
